<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );


/**
 * @package		Joomla
 * @subpackage	JobBoard
 */
class JobBoardTableJAFrontApplications extends JTable
{
    
    /** @var int Primary key */
    var $id             = null;
    var $attachment     = null;
//    var $posted         = null;
	/**
	* @param database A database connector object
	*/
	function __construct(&$db)
	{
		global $mainframe;
        
        $table_name = 'ja_applications';
        parent::__construct( "#__$table_name", 'id', $db );
        
        // Get other field
        $query = 
            "SELECT id, field_name, field_type "
            ." FROM  #__ja_form_fields "
            ." WHERE table_name = '". $table_name ."' AND (field_state = 'chg' OR field_state = 'add')"
            ;
            
       $this->_db->setQuery($query);
       $fields = $this->_db->loadObjectList();

       for($i = 0, $n = count($fields); $i < $n; $i++){
           $field_name = $fields[$i]->field_name; 
           $this->$field_name = null;
           
           $count = 0;
           if (($fields[$i]->field_type=='IMAGE')||($fields[$i]->field_type=='FILE')||($fields[$i]->field_type=='DATE_CAL'))
           {
           	$arr_temp[$count]['name'] = $fields[$i]->field_name;
           	$arr_temp[$count]['type'] = $fields[$i]->field_type;
           	$count++;
           }           
       }
       $this->spec_field = $arr_temp;
    }
	
	
}